local thbattle__quanzouhua_jiaoxie = fk.CreateSkill {

  name = "thbattle__quanzouhua_jiaoxie",

  tags = {  },

}



thbattle__quanzouhua_jiaoxie:addEffect(fk.Damage, {
  anim_type = "control",
  prompt = "#thbattle__quanzouhua_jiaoxie",
  can_trigger = function(self, event, target, player, data)
    return target == player and player:hasSkill(thbattle__quanzouhua_jiaoxie.name) and data.card and
        (data.card.trueName == "slash" or data.card.trueName == "duel")
        and data.to ~= player and not data.to:isKongcheng()
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    room:viewCards(player,{
      cards=data.to:getCardIds("h"),
      skill_name=thbattle__quanzouhua_jiaoxie.name,
      prompt="$ViewCardsFrom:" .. data.to.id
    })
    local cards = table.filter(data.to:getCardIds("h"), function(cid)
      return Fk:getCardById(cid).type == Card.TypeTrick or Fk:getCardById(cid).trueName == "slash"
    end)
    data.to:addToPile("$thbattle_jiaoxie", cards, false, thbattle__quanzouhua_jiaoxie.name)
  end,
})
thbattle__quanzouhua_jiaoxie:addEffect(fk.EventPhaseEnd, {
  can_refresh = function(self, event, target, player, data)
    return target == player and #player:getPile("$thbattle_jiaoxie") > 0 and player.phase == Player.Discard
  end,
  on_refresh = function(self, event, target, player, data)
    local cards = player:getPile("$thbattle_jiaoxie")
    player.room:moveCardTo(cards, Card.PlayerHand, player, fk.ReasonJustMove, thbattle__quanzouhua_jiaoxie.name, nil, false, player)
  end,
})

return thbattle__quanzouhua_jiaoxie